package strategy;

/**
 * @Author：LJ
 * @Description：封装角色
 * @Date: 2017/11/30
 * @Modified By:
 */
public class Context {
    //抽象策略
    private Strategy strategy;

    //通过构造函数设置具体策略
    public Context(Strategy strategy) {
        this.strategy = strategy;
    }

    //封装后的策略方法
    public void doAnything() {
        strategy.doSomething();
    }

}
